package com.bfly.mall.user.enums;

/**
 * 性别类型枚举
 *
 * @author 长沙商脉科技有限公司
 * @date 2020/9/18 14:53
 */
public enum GenderType {
    UN_KNOW(0, "未知"),
    BOY(1, "男"),
    GIRL(2, "女");

    GenderType(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public static GenderType getGender(int type) {
        for (GenderType gender : GenderType.values()) {
            if (gender.getId() == type) {
                return gender;
            }
        }
        return null;
    }

    private int id;

    private String name;

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }
}
